using Godot;
using System;

public partial class EnemyAttackArea : Area2D
{
	// Called when the node enters the scene tree for the first time.
	private Enemy _root;
	public override void _Ready()
	{
		BodyShapeEntered += OnCollisonEnemyAttackCheck;
		BodyShapeExited += OnCollisionEnemyEndAttackCheck;
		_root = GetParent<Enemy>();
	}

	private void OnCollisionEnemyEndAttackCheck(Rid bodyRid, Node2D body, long bodyShapeIndex, long localShapeIndex)
	{
		_root.isAttack = false;
	}

	private void OnCollisonEnemyAttackCheck(Rid bodyRid, Node2D body, long bodyShapeIndex, long localShapeIndex)
	{
		GD.Print("这里是ENEMY攻击子节点碰撞,", body.Name, bodyShapeIndex, localShapeIndex);
		_root.isAttack = true;
	}



	// Called every frame. 'delta' is the elapsed time since the previous frame.
	public override void _Process(double delta)
	{
	}
}
